package com.hippo.core.ui.components

import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxScope
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.painter.Painter
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.painterResource
import com.hippo.core.R

@Composable
fun ImageBackground(modifier: Modifier = Modifier, content: @Composable BoxScope.() -> Unit) {
    Box(modifier = modifier) {
        Image(
            painter = painterResource(R.mipmap.cardbg),
            contentDescription = null, // 图片的描述，如果是背景可以设为null
            contentScale = ContentScale.Crop, // 裁剪图片以适应屏幕
            modifier = Modifier.fillMaxWidth()
        )
        content() // 在图片之上添加其他内容
    }
}

